# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=emacs-rime
pkgver=1.0.5_git20240130
_gitrev=d8c0a99b0282d3e0aca53146789f6864181228e7
pkgrel=0
_pkgreal=rime
pkgdesc="RIME in Emacs"
url="https://github.com/DogLooksGood/emacs-rime"
arch="all"
license="GPL-3.0-or-later"
depends="
	cmd:emacs
	emacs-dash
	emacs-popup
	emacs-posframe
	"
makedepends="emacs-nox librime-dev"
checkdepends="rime-plum-data"
source="https://github.com/DogLooksGood/emacs-rime/archive/$_gitrev/emacs-rime-$_gitrev.tar.gz"
builddir="$srcdir/$pkgname-$_gitrev"
options="!check" # opens an interactive Emacs window

build() {
	make lib

	emacs -batch -q -no-site-file -L . \
		-f batch-byte-compile \
		rime*.el
}

check() {
	make HOME="$srcdir" test
}

package() {
	install -Dvm644 rime*.el* librime-emacs.so \
		-t "$pkgdir"/usr/share/emacs/site-lisp/

	cd "$pkgdir"/usr/share/emacs/site-lisp
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

sha512sums="
d72e2e0fb72fec0cc1e2a5dff86480e1892c962799e258a12d5c2fe41d8a9d54226d0406ed30d19f111c099d22776691fe1c63a2a55320107f2c6fa9743a068f  emacs-rime-d8c0a99b0282d3e0aca53146789f6864181228e7.tar.gz
"
